package com.amigo.online.consumer.user.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.amigo.online.common.base.controller.BaseConsumerController;
import com.amigo.online.common.core.response.Response;
import com.amigo.online.common.param.dto.sms.SmsDto;
import com.amigo.online.consumer.user.service.SmsService;

/**
 * 短信相关
 * @author amigo
 *
 */

@RestController
@RequestMapping(value = "/sms", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class SmsController extends BaseConsumerController {

	@Autowired
	SmsService smsService;
	
	@PostMapping(value = "/code")
	public ResponseEntity<Response> getSmsCode(HttpServletRequest request) {
		SmsDto dto = (SmsDto) getDto(request, SmsDto.class);
		return smsService.smsCode(dto);
	}
	
	@GetMapping(value = "/updatepassword/code")
	public ResponseEntity<Response> sendSmsForUserUpdatePassword() {
		return smsService.sendSmsForUserUpdatePassword();
	}
	
}
